import Vue from 'vue'
import Vuex from '../pvuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    count: 10
  },
  mutations: {
    addCount(state, info) {
      state.count = state.count + info
    }
  },
  actions: {
    addCount({commit}, info) {
      // console.log(obj, info)
      setTimeout(() => {
        commit('addCount', info)
      }, 1000)
    }
  },
  getters: {
    doubleCount(state) {
      return state.count * 2
    },
    testCount(state) {
      return state.count * 3
    },
  },
  modules: {
  }
})
